using System;
using System.Collections.Generic;
using System.Text;
using Emlyn.Website.Articles;
using System.ComponentModel;
using Emlyn.Website.Base;

namespace Emlyn.Website.ArticlesPresentation
{
    public class PresentArticle: PresentBase
    {
        protected Article _article;

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public Article aArticle
        {
            get
            {
                if (_article == null)
                {
                    ArticleQuery laq = new ArticleQuery();
                    string larticleCode = Convert.ToString(ViewState["ArticleCode"]);
                    _article = laq.GetArticleByArticleCode(larticleCode);
                }
                return _article;
            }
            set
            {
                _article = value;
                if (_article != null)
                    ViewState["ArticleCode"] = _article.ArticleCode;
                else
                    ViewState["ArticleCode"] = null;
            }
        }
    }
}
